<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="format-detection" content="telephone=no"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <script src="/js/resize.js"></script>
    <% include baiduTJ.html %>
    <link rel="stylesheet" href="/css/myreset.min.css">
    <link rel="stylesheet" href="/contact/css/index.css">
    <link rel="stylesheet" href="/css/animate.css">
    <title><%= title %></title>
</head>
<body>

<div class="outer">
    <div class="container" id="container">


        <div class="word">
            <div><span><%= prize_word[0] %></span></div>
            <div><span><%= prize_word[1] %></span>已经等的不耐烦了</div>
        </div>

        <div class="jd-5 <%= class_arr[0] %>"></div>
        <div class="jd-30 <%= class_arr[1] %>"></div>
        <div class="lxx <%= class_arr[2] %>"></div>
        <div class="boll"></div>


        <div class="input name">
            <input id="name" type="text" placeholder="主卡人姓名">
        </div>

        <div class="must na"><span>(必填)</span></div>

        <div class="input phone">
            <input id="phone" type="text" placeholder="银行卡预留手机号">
        </div>
        <div class="must ph"><span>(必填)</span></div>

        <div class="next <%= submit == 0 ? 'disabled' : '' %>"></div>
        <div class="click-area page"></div>
    </div>
</div>

<div class="dialog success animated fadeIn">
    <div class="word">
        <div class="click-area success"></div>
    </div>
</div>

<div class="dialog fail animated fadeIn">
    <div class="word">
        <div class="click-area fail"></div>
    </div>
</div>

<script src="/js/zepto.1.1.6.min.js"></script>
<script src="/js/base.2.0.js"></script>
<script src="/js/jweixin-1.0.0.js"></script>
<script src="/js/weixin.js"></script>
<% include wxshare.html %>
<% include music.html %>
<script>
    $(function () {
        var dh = $(window).height();
        var ch = $("#container").height();
        if (ch > dh) {
            var ro = dh / ch;
            $(".outer").css({
                "font-size": ro + "rem"
            });
        }
    })
</script>


<script>
    var clickFlag = false;

    $(".next").on("tap", function () {
        playBtn();
        if ($(this).hasClass("disabled")) {
            return alert("您已经提交过了,无法继续提交");
        }
        var dto = {
            pids: getQueryString("prize"),
            name: $("#name").val(),
            phone: $("#phone").val(),
            openid: getQueryString("openid")
        }

        if (!dto.name) {
            return alert("姓名不能为空");
        }

        if (!dto.phone) {
            return alert("手机号不能为空");
        }

        if (!(/^1[3|4|5|8|7]\d{9}$/.test(dto.phone))) {
            return alert("手机号格式不正确");
        }

        if (clickFlag) return;
        clickFlag = true;


        $.ajax({
            url: "/index/contact/saveinfo",
            type: "POST",
            dataType: "json",
            data: dto,
            success: function (data) {
                if (data.errno) {
                    $(".dialog.fail").show();
                } else {
                    $(".dialog.success").show();
                }
                clickFlag = false;
            },
            error: function () {
                alert("网络错误");
                clickFlag = false;
            }
        })
    });

    $(".dialog.success").on("tap", function () {
        window.location.href = "/index/home?openid=" + getQueryString("openid");
    })
    $(".dialog.fail").on("tap", function () {
        $(this).fadeOut();
    })

    $(".click-area").on("tap", function () {
        window.location.href = "http://scb.helloshineshow.com/pl-card/index.html?pid=WechatCart";
        return false;
    });
</script>
</body>
</html>